package com.elong.businesstravel.protocol.ticket;

import java.util.ArrayList;
import java.util.List;

import org.apache.http.Header;
//import org.json.JSONArray;
//import org.json.JSONObject;

import android.view.animation.Transformation;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.elong.businesstravel.entitys.TrainStation;
import com.elong.businesstravel.protocol.baseresponse.BaseELongJsonHttpResponse;

public class GetStationListResponse extends BaseELongJsonHttpResponse {

	public List<TrainStation> trainStations = new ArrayList<TrainStation>();
	public String responseString;

	@Override
	public void onSuccess(int statusCode, Header[] headers,
			org.json.JSONObject mainJsonObject) throws Throwable {

		responseString = mainJsonObject.toString();
		
		JSONObject jsonObject = JSONObject
				.parseObject(responseString);
		
		JSONArray jsonArray = jsonObject.getJSONArray("stations");
		for (int i = 0; i < jsonArray.size(); i++) {
			
			JSONObject itemJsonObject = jsonArray.getJSONObject(i);
			TrainStation trainStation = JSON.toJavaObject(itemJsonObject, TrainStation.class);
			trainStations.add(trainStation);
			
		}
	}

}
